home *** CD-ROM | disk | FTP | other *** search
- _global.videoNavigationCLASS = function()
- {
- this.init();
- };
- Object.registerClass("VIDEO_NAVIGATION",_global.videoNavigationCLASS);
- _global.videoNavigationCLASS.prototype = new MovieClip();
- _global.videoNavigationCLASS.prototype.register = function(element, target)
- {
- var element;
- if(element.toUpperCase() == "VIDEO")
- {
- this.videoTarget = target;
- }
- else if(element.toUpperCase() == "MUTE")
- {
- this.volumeInterval = setInterval(this,"onVolume",1000 / (_global.FPS * 2));
- this.MUTE.hitArea = target;
- target.gotoAndStop(1);
- }
- else
- {
- this[element].hitArea = target;
- target.gotoAndStop(1);
- }
- };
- _global.videoNavigationCLASS.prototype.setEnabled = function(state)
- {
- this.PLAY.enabled = state;
- this.STOP.enabled = state;
- this.PAUSE.enabled = state;
- this.REWIND.enabled = state;
- this.FORWARD.enabled = state;
- this.MUTE.enabled = state;
- this.VOLUME_SLIDER.enabled = state;
- this.VOLUME_SLIDER_BAR.enabled = state;
- this.POSITION_SLIDER.enabled = state;
- this.POSITION_SLIDER_BAR.enabled = state;
- };
- _global.videoNavigationCLASS.prototype.setOnEnd = function(target, method)
- {
- this.onEndArgs = arguments;
- };
- _global.videoNavigationCLASS.prototype.getOnEnd = function()
- {
- return this.onEndArgs[0][this.onEndArgs[1]];
- };
- _global.videoNavigationCLASS.prototype.onEnd = function()
- {
- this.onEndArgs[0][this.onEndArgs[1]].apply(this.onEndArgs[0],this.onEndArgs.slice(2));
- };
- ASSetPropFlags(_global.videoNavigationCLASS.prototype,["onEnd"],1);
- _global.videoNavigationCLASS.prototype.unload = function()
- {
- clearInterval(this.volumeSliderDrag);
- clearInterval(this.positionSliderDrag);
- clearInterval(this.rewindInterval);
- clearInterval(this.forwardInterval);
- clearInterval(this.endInterval);
- delete this.endInterval;
- Key.removeListener(this.keyListener);
- };
- _global.videoNavigationCLASS.prototype.init = function()
- {
- this.LABEL._visible = false;
- this.keyListener = new Object();
- this.keyListener.controller = this;
- Key.addListener(this.keyListener);
- this.keyListener.onKeyDown = function()
- {
- if(Key.isDown(32))
- {
- if(this.controller.isPlaying)
- {
- this.controller.pauseVideo();
- }
- else
- {
- this.controller.start();
- }
- }
- if(Key.isDown(37))
- {
- this.controller.onRewindPress();
- this.rewindPressed = true;
- }
- if(Key.isDown(39))
- {
- this.controller.onForwardPress();
- this.forwardPressed = true;
- }
- };
- this.keyListener.onKeyUp = function()
- {
- if(!Key.isDown(37) && this.rewindPressed)
- {
- this.rewindPressed = false;
- this.controller.onRewindRelease();
- }
- if(!Key.isDown(39) && this.forwardPressed)
- {
- this.forwardPressed = false;
- this.controller.onForwardRelease();
- }
- };
- this.createEmptyMovieClip("PLAY",++this.depth);
- this.PLAY.controller = this;
- this.PLAY.onPress = function()
- {
- this.controller.OnPlayPress();
- };
- this.PLAY.onRelease = this.PLAY.onReleaseOutside = function()
- {
- this.controller.OnPlayRelease();
- };
- this.createEmptyMovieClip("PAUSE",++this.depth);
- this.PAUSE.controller = this;
- this.PAUSE.onPress = function()
- {
- this.controller.OnPausePress();
- };
- this.PAUSE.onRelease = this.PAUSE.onReleaseOutside = function()
- {
- this.controller.OnPauseRelease();
- };
- this.createEmptyMovieClip("REWIND",++this.depth);
- this.REWIND.controller = this;
- this.REWIND.onPress = function()
- {
- this.controller.OnRewindPress();
- };
- this.REWIND.onRelease = this.REWIND.onReleaseOutside = function()
- {
- this.controller.OnRewindRelease();
- };
- this.createEmptyMovieClip("FORWARD",++this.depth);
- this.FORWARD.controller = this;
- this.FORWARD.onPress = function()
- {
- this.controller.OnForwardPress();
- };
- this.FORWARD.onRelease = this.FORWARD.onReleaseOutside = function()
- {
- this.controller.OnForwardRelease();
- };
- this.createEmptyMovieClip("VOLUME_SLIDER_BAR",++this.depth);
- this.VOLUME_SLIDER_BAR.controller = this;
- this.VOLUME_SLIDER_BAR.onPress = function()
- {
- this.controller.onVolumeSliderBarPress();
- };
- this.VOLUME_SLIDER_BAR.onRelease = this.VOLUME_SLIDER_BAR.onReleaseOutside = function()
- {
- this.controller.onVolumeSliderBarRelease();
- };
- this.createEmptyMovieClip("MUTE",++this.depth);
- this.MUTE.controller = this;
- this.MUTE.onPress = function()
- {
- this.controller.onMutePress();
- };
- this.MUTE.onRelease = this.MUTE.onReleaseOutside = function()
- {
- this.controller.OnMuteRelease();
- };
- this.bMute = false;
- this.createEmptyMovieClip("VOLUME_SLIDER",++this.depth);
- this.VOLUME_SLIDER.controller = this;
- this.VOLUME_SLIDER.onPress = function()
- {
- this.controller.onVolumeSliderPress();
- };
- this.VOLUME_SLIDER.onRelease = this.VOLUME_SLIDER.onReleaseOutside = function()
- {
- this.controller.onVolumeSliderRelease();
- };
- this.nVolume = 70;
- this.createEmptyMovieClip("POSITION_SLIDER_BAR",++this.depth);
- this.POSITION_SLIDER_BAR.controller = this;
- this.POSITION_SLIDER_BAR.onPress = function()
- {
- this.controller.onPositionSliderBarPress();
- };
- this.POSITION_SLIDER_BAR.onRelease = this.POSITION_SLIDER_BAR.onReleaseOutside = function()
- {
- this.controller.onPositionSliderBarRelease();
- };
- this.createEmptyMovieClip("POSITION_SLIDER",++this.depth);
- this.POSITION_SLIDER.controller = this;
- this.POSITION_SLIDER.onPress = function()
- {
- this.controller.onPositionSliderPress();
- };
- this.POSITION_SLIDER.onRelease = this.POSITION_SLIDER.onReleaseOutside = function()
- {
- this.controller.onPositionSliderRelease();
- };
- if(!this.slidePositionInterval)
- {
- this.slidePositionInterval = setInterval(this,"onSliderPosition",1000 / (_global.FPS / 5));
- }
- };
- _global.videoNavigationCLASS.prototype.onEnterFrame = function()
- {
- if(this.endEnterFrame)
- {
- this.onEndEnterFrame();
- }
- };
- _global.videoNavigationCLASS.prototype.onEndEnterFrame = function()
- {
- if(this.videotarget._currentframe == this.videotarget._totalframes)
- {
- clearInterval(this.endInterval);
- delete this.endInterval;
- this.onEnd();
- this.stopVideo();
- }
- };
- _global.videoNavigationCLASS.prototype.OnPlayPress = function()
- {
- this.PLAY.hitArea.gotoAndStop("DOWN");
- };
- _global.videoNavigationCLASS.prototype.OnPlayRelease = function()
- {
- this.start();
- this.onPlayReleaseTarget[this.onPlayReleaseMethod]();
- };
- _global.videoNavigationCLASS.prototype.start = function()
- {
- this.PLAY.hitArea.gotoAndStop("DOWN");
- this.STOP.hitArea.gotoAndStop("UP");
- this.PAUSE.hitArea.gotoAndStop("UP");
- if(this.videotarget._currentframe == this.videotarget._totalframes)
- {
- this.videoTarget.gotoAndPlay(1);
- }
- this.endEnterFrame = true;
- this.onEndInterval();
- this.videoTarget.play();
- this.isPlaying = true;
- };
- _global.videoNavigationCLASS.prototype.OnPausePress = function()
- {
- this.PAUSE.hitArea.gotoAndStop("DOWN");
- };
- _global.videoNavigationCLASS.prototype.OnPauseRelease = function()
- {
- this.pauseVideo();
- };
- _global.videoNavigationCLASS.prototype.pauseVideo = function()
- {
- this.PLAY.hitArea.gotoAndStop("UP");
- this.PAUSE.hitArea.gotoAndStop("DOWN");
- this.videoTarget.stop();
- this.isPlaying = false;
- this.onPauseReleaseTarget[this.onPauseReleaseMethod]();
- };
- _global.videoNavigationCLASS.prototype.OnStopPress = function()
- {
- this.STOP.hitArea.gotoAndStop("DOWN");
- };
- _global.videoNavigationCLASS.prototype.OnStopRelease = function()
- {
- this.stopVideo();
- };
- _global.videoNavigationCLASS.prototype.stopVideo = function()
- {
- this.PLAY.hitArea.gotoAndStop("UP");
- this.PAUSE.hitArea.gotoAndStop("UP");
- this.REWIND.hitArea.gotoAndStop("UP");
- this.FORWARD.hitArea.gotoAndStop("UP");
- this.STOP.hitArea.gotoAndStop("DOWN");
- this.videoTarget.stop();
- this.isPlaying = false;
- this.endEnterFrame = false;
- this.onStopReleaseTarget[this.onStopReleaseMethod]();
- };
- _global.videoNavigationCLASS.prototype.OnRewindPress = function()
- {
- this.REWIND.hitArea.gotoAndStop("DOWN");
- this.rewindInterval = setInterval(this,"onRewindInterval",1000 / (_global.FPS + 1));
- this.rewindIntervalCount = 0;
- this.onRewindInterval();
- };
- _global.videoNavigationCLASS.prototype.OnRewindRelease = function()
- {
- this.REWIND.hitArea.gotoAndStop("UP");
- clearInterval(this.rewindInterval);
- this.onRewindReleaseTarget[this.onRewindReleaseMethod]();
- };
- _global.videoNavigationCLASS.prototype.onRewindInterval = function()
- {
- if(this.RewindIntervalCount < 5)
- {
- if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(this.videoTarget._currentframe - _global.FPS * 2);
- }
- else
- {
- this.videoTarget.gotoAndStop(this.videoTarget._currentframe - _global.FPS * 2);
- }
- }
- else if(this.RewindIntervalCount < 20)
- {
- if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(this.videoTarget._currentframe + _global.FPS * 4);
- }
- else
- {
- this.videoTarget.gotoAndStop(this.videoTarget._currentframe + _global.FPS * 4);
- }
- }
- else if(this.RewindIntervalCount < 30)
- {
- if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(this.videoTarget._currentframe - _global.FPS * 8);
- }
- else
- {
- this.videoTarget.gotoAndStop(this.videoTarget._currentframe - _global.FPS * 8);
- }
- }
- else if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(this.videoTarget._currentframe - _global.FPS * 16);
- }
- else
- {
- this.videoTarget.gotoAndStop(this.videoTarget._currentframe - _global.FPS * 16);
- }
- this.forwardIntervalCount = this.forwardIntervalCount + 1;
- };
- _global.videoNavigationCLASS.prototype.OnForwardPress = function()
- {
- this.FORWARD.hitArea.gotoAndStop("DOWN");
- this.forwardIntervalCount = 0;
- this.forwardInterval = setInterval(this,"onForwardInterval",1000 / (_global.FPS + 1));
- this.onForwardInterval();
- };
- _global.videoNavigationCLASS.prototype.OnForwardRelease = function()
- {
- this.FORWARD.hitArea.gotoAndStop("UP");
- clearInterval(this.forwardInterval);
- this.onForwardReleaseTarget[this.onforwardReleaseMethod]();
- };
- _global.videoNavigationCLASS.prototype.onForwardInterval = function()
- {
- if(this.forwardIntervalCount < 5)
- {
- if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(this.videoTarget._currentframe + _global.FPS * 2);
- }
- else
- {
- this.videoTarget.gotoAndStop(this.videoTarget._currentframe + _global.FPS * 2);
- }
- }
- else if(this.forwardIntervalCount < 20)
- {
- if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(this.videoTarget._currentframe + _global.FPS * 4);
- }
- else
- {
- this.videoTarget.gotoAndStop(this.videoTarget._currentframe + _global.FPS * 4);
- }
- }
- else if(this.forwardIntervalCount < 30)
- {
- if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(this.videoTarget._currentframe + _global.FPS * 8);
- }
- else
- {
- this.videoTarget.gotoAndStop(this.videoTarget._currentframe + _global.FPS * 8);
- }
- }
- else if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(this.videoTarget._currentframe + _global.FPS * 16);
- }
- else
- {
- this.videoTarget.gotoAndStop(this.videoTarget._currentframe + _global.FPS * 16);
- }
- if(this.endEnterFrame)
- {
- this.onEndEnterFrame();
- }
- this.forwardIntervalCount = this.forwardIntervalCount + 1;
- };
- _global.videoNavigationCLASS.prototype.setVolume = function(value)
- {
- value = Math.round(value);
- if(value > 100)
- {
- value = 100;
- }
- else if(value < 0 || parseFloat(value) != value)
- {
- value = 0;
- }
- this.nVolume = value;
- };
- _global.videoNavigationCLASS.prototype.getVolume = function()
- {
- return this.nVolume;
- };
- _global.videoNavigationCLASS.prototype.onVolume = function()
- {
- var sTrack;
- sTrack = new Sound(this.videoTarget);
- if(this.bMute)
- {
- sTrack.setVolume(0);
- }
- else
- {
- sTrack.setVolume(this.nVolume);
- }
- this.VOLUME_SLIDER.hitArea._x = this.VOLUME_SLIDER_BAR.hitArea._x + this.VOLUME_SLIDER_BAR.hitArea._width / 100 * this.nVolume;
- };
- _global.videoNavigationCLASS.prototype.onVolumeSliderBarPress = function()
- {
- this.volumeSliderDrag = setInterval(this,"onVolumeSliderDrag",20);
- };
- _global.videoNavigationCLASS.prototype.onVolumeSliderBarRelease = function()
- {
- var sTrack;
- clearInterval(this.volumeSliderDrag);
- this.onVolumeSliderBarTarget[this.onVolumeSliderBarMethod](this.nVolume);
- };
- _global.videoNavigationCLASS.prototype.onMutePress = function()
- {
- if(this.bMute)
- {
- this.MUTE.hitArea.gotoAndStop("UP");
- }
- else
- {
- this.MUTE.hitArea.gotoAndStop("DOWN");
- }
- };
- _global.videoNavigationCLASS.prototype.onMuteRelease = function()
- {
- var sTrack;
- sTrack = new Sound(this.videoTarget);
- if(this.bMute)
- {
- this.bMute = false;
- this.onVolume();
- }
- else
- {
- this.bMute = true;
- this.onVolume();
- }
- this.onMuteReleaseTarget[this.onMuteReleaseTargetMethod](this.bMute);
- };
- _global.videoNavigationCLASS.prototype.onVolumeSliderPress = function()
- {
- this.volumeSliderDrag = setInterval(this,"onVolumeSliderDrag",20);
- };
- _global.videoNavigationCLASS.prototype.onVolumeSliderRelease = function()
- {
- clearInterval(this.volumeSliderDrag);
- this.onVolumeSliderTarget[this.onVolumeSliderMethod](this.nVolume);
- };
- _global.videoNavigationCLASS.prototype.onVolumeSliderDrag = function()
- {
- updateAfterEvent();
- var volume = this.VOLUME_SLIDER_BAR.hitArea._parent._xmouse - this.VOLUME_SLIDER_BAR.hitArea._x;
- volume /= this.VOLUME_SLIDER_BAR.hitArea._width / 100;
- this.setVolume(volume);
- };
- _global.videoNavigationCLASS.prototype.setSliderPosition = function(nPositionPercent)
- {
- if(isNaN(parseFloat(nPositionPercent)))
- {
- nPositionPercent = 0;
- }
- nPositionPercent = Math.min(Math.max(nPositionPercent,0),100);
- var nFrame = Math.round(nPositionPercent * (this.videoTarget._totalframes / 100)) + 1;
- if(this.isPlaying)
- {
- this.videoTarget.gotoAndPlay(nFrame);
- }
- else
- {
- this.videoTarget.gotoAndStop(nFrame);
- }
- this.nPositionPercent = nPositionPercent;
- };
- _global.videoNavigationCLASS.prototype.getSliderPosition = function()
- {
- return this.nPositionPercent;
- };
- _global.videoNavigationCLASS.prototype.onSliderPosition = function()
- {
- this.POSITION_SLIDER.hitArea._x = this.POSITION_SLIDER_BAR.hitArea._x + this.POSITION_SLIDER_BAR.hitArea._width / 100 * (100 * this.videoTarget._currentframe / this.videoTarget._totalframes);
- };
- _global.videoNavigationCLASS.prototype.onPositionSliderBarPress = function()
- {
- this.positionSliderDrag = setInterval(this,"onPositionSliderDrag",20);
- this.tmpSlideisPlaying = this.isPlaying;
- this.isPlaying = false;
- };
- _global.videoNavigationCLASS.prototype.onPositionSliderBarRelease = function()
- {
- var sTrack;
- clearInterval(this.positionSliderDrag);
- this.onPositionSliderTarget[this.onPositionSliderMethod](this.nSliderPosition);
- var position = this.POSITION_SLIDER_BAR.hitArea._parent._xmouse - this.POSITION_SLIDER_BAR.hitArea._x;
- position /= this.POSITION_SLIDER_BAR.hitArea._width / 100;
- this.isPlaying = this.tmpSlideisPlaying;
- delete this.tmpSlideisPlaying;
- this.setSliderPosition(position);
- this.onPositionSliderDrag();
- };
- _global.videoNavigationCLASS.prototype.onPositionSliderPress = function()
- {
- this.positionSliderDrag = setInterval(this,"onPositionSliderDrag",20);
- this.tmpSlideisPlaying = this.isPlaying;
- this.isPlaying = false;
- };
- _global.videoNavigationCLASS.prototype.onPositionSliderRelease = function()
- {
- var sTrack;
- clearInterval(this.positionSliderDrag);
- this.onPositionSliderDrag();
- this.isPlaying = this.tmpSlideisPlaying;
- delete this.tmpSlideisPlaying;
- var position = this.POSITION_SLIDER_BAR.hitArea._parent._xmouse - this.POSITION_SLIDER_BAR.hitArea._x;
- position /= this.POSITION_SLIDER_BAR.hitArea._width / 100;
- this.setSliderPosition(position);
- this.onPositionSliderTarget[this.onPositionSliderMethod](this.nSliderPosition);
- };
- _global.videoNavigationCLASS.prototype.onPositionSliderDrag = function()
- {
- updateAfterEvent();
- this.POSITION_SLIDER.hitArea._x = Math.min(this.POSITION_SLIDER_BAR.hitArea._width + this.POSITION_SLIDER_BAR.hitArea._x,Math.max(this.POSITION_SLIDER_BAR.hitArea._x,this.POSITION_SLIDER_BAR.hitArea._parent._xmouse));
- var position = this.POSITION_SLIDER_BAR.hitArea._parent._xmouse - this.POSITION_SLIDER_BAR.hitArea._x;
- position /= this.POSITION_SLIDER_BAR.hitArea._width / 100;
- this.setSliderPosition(position);
- };
-